FROM denoland/deno:1.40.4 as builder
WORKDIR /home

COPY ./src ./src
COPY ./deno.json ./
RUN deno compile \
    --output ./jianmu-expression-deno \
    --include https://deno.land/x/simple_sandbox@v0.1.1/worker.ts  \
    --allow-net \
    --allow-env \
    --allow-run \
    src/main.ts

FROM docker.jianmuhub.com/library/ubuntu:22.04

# 安装iptables
RUN apt-get update -y && \
    apt-get install -y iptables

# 添加构件
COPY --from=builder /home/jianmu-expression-deno /

CMD /jianmu-expression-deno